package com.amos.knife4j.tool;

import com.github.pagehelper.PageInfo;

/**
 * 分页信息操作工具类
 *
 * @author wang_dgang
 * @since 2018-11-26 15:18:21
 */
public class PageInfoUtil {
    /**
     * 分页信息转换
     *
     * @param newPage
     * @param oldPage
     */
    public static void pageInfoTrans(PageInfo<?> newPage, PageInfo<?> oldPage) {
        newPage.setTotal(oldPage.getTotal());
        newPage.setEndRow(oldPage.getEndRow());
        newPage.setHasNextPage(oldPage.isHasNextPage());
        newPage.setHasPreviousPage(oldPage.isHasPreviousPage());
        newPage.setIsFirstPage(oldPage.isIsFirstPage());
        newPage.setIsLastPage(oldPage.isIsLastPage());
        newPage.setNavigateFirstPage(oldPage.getNavigateFirstPage());
        newPage.setNavigateLastPage(oldPage.getNavigateLastPage());
        newPage.setNavigatepageNums(oldPage.getNavigatepageNums());
        newPage.setNavigatePages(oldPage.getNavigatePages());
        newPage.setNextPage(oldPage.getNextPage());
        newPage.setPageNum(oldPage.getPageNum());
        newPage.setPageSize(oldPage.getPageSize());
        newPage.setPages(oldPage.getPages());
        newPage.setPrePage(oldPage.getPrePage());
        newPage.setSize(oldPage.getSize());
        newPage.setStartRow(oldPage.getStartRow());
    }


}
